package com.shensi.api.admin.client.station;

import com.shensi.api.admin.client.fallback.monitor.SysLogininforClientFallBack;
import com.shensi.api.admin.domian.station.dto.CancelCouponDto;
import com.shensi.api.admin.domian.station.dto.CouponCreationDto;
import com.shensi.api.admin.domian.station.vo.CouponInfoVO;
import com.shensi.common.core.annotation.Log;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.common.core.domain.AjaxResult;
import com.shensi.common.core.domain.ResultData;
import com.shensi.common.core.enums.BusinessType;
import com.shensi.common.core.page.TableDataInfo;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;


/**
 * @author mao
 */
@FeignClient(
        value = CloudConstant.ADMIN_SERVER,
        fallbackFactory = SysLogininforClientFallBack.class)
@Component
public interface CouponCreationClient {

    /**
     * 新增优惠劵
     */
    @PostMapping("/coupon/creation/creation")
    public AjaxResult add(@RequestBody CouponCreationDto couponInfo);

    /**
     * 删除优惠劵
     */
    @PostMapping("/coupon/creation/delete")
    public AjaxResult delete(@RequestBody Long[] couponIssueIds);

    /**
     * 修改优惠劵
     */
    @PutMapping("/coupon/creation/modify")
    public AjaxResult modify(@RequestBody CouponCreationDto couponInfo);

    /**
     * 查询优惠劵发放方式列表/list
     */
    @GetMapping("/coupon/creation/list")
    public TableDataInfo list(CouponCreationDto couponIssue) ;

    /**
     * 更新优惠券状态
     *
     * @param issueId 发行ID
     * @param status  状态值（1：启用，0：停用）
     * @return 更新结果
     */
    @PutMapping("/coupon/creation/status/{issueId}")
    public ResponseEntity<String> updateCouponStatus(
            @ApiParam(value = "发行ID", required = true) @PathVariable("issueId") Long issueId,
            @ApiParam(value = "状态值（1：启用，0：停用）", required = true) @RequestParam("status") String status);


    @GetMapping("/coupon/creation/export")
    public void exportCoupons(@RequestParam("ids") List<String> ids, HttpServletResponse response);



    /**
     * 获取优惠劵发放方式详细信息
     */
    @GetMapping(value = "/coupon/creation/details/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id);


    /**
     * 获取优惠劵发放方式详细信息
     */
    @GetMapping(value = "/coupon/creation/getInfoForCopy/{id}")
    public AjaxResult getInfoForCopy(@PathVariable("id") String id);



    @PostMapping(value = "/coupon/creation/cancelCoupon")
    public ResultData<CouponInfoVO> cancelCoupon(@Valid @RequestBody CancelCouponDto cancelCouponDto);

}
